package cn.myj2c.executor.defined;


import cn.myj2c.executor.Context;
import cn.myj2c.executor.defined.types.JavaClass;
import cn.myj2c.executor.providers.ComparisonProvider;
import cn.myj2c.executor.values.JavaValue;
import org.objectweb.asm.Type;

public class JVMComparisonProvider extends ComparisonProvider {
    @Override
    public boolean checkEquality(JavaValue first, JavaValue second, Context context) {
        if (first.value() instanceof JavaClass && second.value() instanceof JavaClass) {
            return first.as(JavaClass.class).equals(second.value());
        }
        return first == second;
    }

    @Override
    public boolean canCheckEquality(JavaValue first, JavaValue second, Context context) {
        return first.value() instanceof JavaClass && second.value() instanceof JavaClass;
    }

    @Override
    public boolean instanceOf(JavaValue target, Type type, Context context) {
        return false;
    }

    @Override
    public boolean checkcast(JavaValue target, Type type, Context context) {
        return false;
    }

    @Override
    public boolean canCheckInstanceOf(JavaValue target, Type type, Context context) {
        return false;
    }

    @Override
    public boolean canCheckcast(JavaValue target, Type type, Context context) {
        return false;
    }
}
